package com.service.imple.home;

import com.dao.ShopOrderMapper;
import com.entity.ShopOrder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.service.home.ShopOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ShopOrderServiceImple implements ShopOrderService {

    @Autowired
    private ShopOrderMapper shopOrderMapper;

    @Override
    public PageInfo selectByPage(Map param) {
        int pageNum=Integer.parseInt(param.get("pageNum").toString());
        PageHelper.startPage(pageNum,6);
        List<ShopOrder> list = shopOrderMapper.SelectPage(param);
        PageInfo<ShopOrder> info =new PageInfo<>(list);
        return info;
    }

    @Override
    public List select(Map map) {
        return null;
    }

    @Override
    public int insert(ShopOrder shopOrder) {
        return shopOrderMapper.insert(shopOrder);
    }

    @Override
    public int update(ShopOrder shopOrder) {
        return shopOrderMapper.updateByPrimaryKey(shopOrder);
    }

    @Override
    public int delete(int id) {
        return shopOrderMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<ShopOrder> SelectAll(ShopOrder shopOrder) {
        return shopOrderMapper.SelectAll(shopOrder);
    }

    @Override
    public List<ShopOrder> SelectPage(Map map) {
        return shopOrderMapper.SelectPage(map);
    }

    @Override
    public List<ShopOrder> Select(ShopOrder shopOrder) {
        return shopOrderMapper.Select(shopOrder);
    }

    @Override
    public int Delete(ShopOrder shopOrder) {
        return shopOrderMapper.Delete(shopOrder);
    }
}
